package com.chennan.basedatasource.api.rest.controller;

import com.chennan.basedatasource.domain.modal.City;
import com.chennan.basedatasource.domain.service.CityService;
import com.chennan.redis.domain.number.NumberEnum;
import com.chennan.redis.domain.number.NumberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author chennan
 * @createTime 2021年07月26日 15:53:00
 */
@RestController
@Api("城市操作")
public class CityController {


    @Autowired
    private CityService cityService;

    @Autowired
    private NumberService numberService;


    @GetMapping("/get-city")
    @ApiOperation("获取顺序城市")
    public City getCitys(){
        BigDecimal nextNumber = numberService.getNextNumber(NumberEnum.CITY_NUMBER);
        City city = cityService.selectByPrimaryKey(nextNumber.intValue());
        return city;
    }


}
